﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Yule8xWeb.Models;
using Yule8xWeb.Typelib;

namespace Yule8xWeb.Webform.Index
{
    public partial class Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            IList<MenuItemObject> menus = MenuModel.GetMenus();
            rptMenu.ItemDataBound += RptMenu_ItemDataBound;
            rptMenu.DataSource = menus;
            rptMenu.DataBind();
        }

        private void RptMenu_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            Repeater rpt2=e.Item.FindControl("rptMenu2") as Repeater;
            rpt2.DataSource = ((MenuItemObject)e.Item.DataItem).children;
            rpt2.DataBind();
        }
    }
}